import 'package:flutter/material.dart';

class AlertDialogSample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: AppBar(
        title: Text("AlertDialogSample"),
      ),
      body: new Builder(builder: (BuildContext context) {
        return Center(
          child: AlertDialog(
            titlePadding: EdgeInsets.all(10),
            title: Text("AlertDialog 标题"),
            contentPadding: EdgeInsets.all(18),
            content: SingleChildScrollView(
              child: ListBody(
                children: <Widget>[Text("是否要删除？"), Text("要知道一旦删除就不可恢复！")],
              ),
            ),
            actions: <Widget>[
              FlatButton(
                child: Text("取消"),
                onPressed: () {},
                textColor: Colors.black,
              ),
              FlatButton(
                child: Text("确定"),
                onPressed: () {
                  Scaffold.of(context).showSnackBar(new SnackBar(
                    content: new Text("点击了那个删除"),
                    duration: Duration(seconds: 2),
                    backgroundColor: Colors.brown,
                  ));
                },
                textColor: Colors.red,
              ),
            ],
          ),
        );
      }),
    );
  }
}
